package com.rent.common.constant;

/**
 * 公共常量类
 * 存储系统中使用的各种常量值
 */
public class CommonConstant {
    
    // ==================== JWT相关 ====================
    
    /**
     * JWT密钥（生产环境请使用配置文件）
     */
    public static final String JWT_SECRET = "RentSystem2024SecretKeyForJWTTokenGeneration";
    
    /**
     * JWT过期时间（毫秒）- 默认7天
     */
    public static final long JWT_EXPIRE_TIME = 7 * 24 * 60 * 60 * 1000L;
    
    /**
     * Token请求头名称
     */
    public static final String TOKEN_HEADER = "Authorization";
    
    /**
     * Token前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";
    
    
    // ==================== Redis缓存键前缀 ====================
    
    /**
     * 用户缓存前缀
     */
    public static final String CACHE_USER_PREFIX = "user:";
    
    /**
     * 房源缓存前缀
     */
    public static final String CACHE_HOUSE_PREFIX = "house:";
    
    /**
     * 房源搜索缓存前缀
     */
    public static final String CACHE_HOUSE_SEARCH_PREFIX = "house:search:";
    
    /**
     * 房源浏览量缓存前缀
     */
    public static final String CACHE_HOUSE_VIEW_COUNT_PREFIX = "house:view:";
    
    /**
     * 分布式锁前缀
     */
    public static final String LOCK_PREFIX = "lock:";
    
    /**
     * 预约锁前缀
     */
    public static final String LOCK_APPOINTMENT_PREFIX = "lock:appointment:";

    /**
     * 用户在线websocket前缀
     */

    public static final String USER_SESSION = "user:session:";


    public static final String USER_SESSION_UUID = "user:session:uuid:";

    /**
     * 用户在线session前缀
     */
    public static final String USER_KEY = "user:key:";
    
    
    // ==================== 缓存过期时间（秒） ====================
    
    /**
     * 用户信息缓存过期时间 - 30分钟
     */
    public static final long CACHE_USER_EXPIRE = 30 * 60;
    
    /**
     * 房源信息缓存过期时间 - 1小时
     */
    public static final long CACHE_HOUSE_EXPIRE = 60 * 60;
    
    /**
     * 搜索结果缓存过期时间 - 10分钟
     */
    public static final long CACHE_SEARCH_EXPIRE = 10 * 60;
    
    
    // ==================== 分页相关 ====================
    
    /**
     * 默认页码
     */
    public static final int DEFAULT_PAGE_NO = 1;
    
    /**
     * 默认每页数量
     */
    public static final int DEFAULT_PAGE_SIZE = 10;
    
    /**
     * 最大每页数量
     */
    public static final int MAX_PAGE_SIZE = 100;
    
    
    // ==================== 文件上传相关 ====================
    
    /**
     * 文件上传路径前缀
     */
    public static final String UPLOAD_PATH_PREFIX = "rent-system";
    
    /**
     * 头像上传路径
     */
    public static final String UPLOAD_AVATAR_PATH = "avatar";
    
    /**
     * 房源图片上传路径
     */
    public static final String UPLOAD_HOUSE_PATH = "house";
    
    /**
     * 允许上传的图片格式
     */
    public static final String[] ALLOWED_IMAGE_TYPES = {".jpg", ".jpeg", ".png", ".gif", ".webp"};
    
    /**
     * 最大文件上传大小（字节）- 5MB
     */
    public static final long MAX_FILE_SIZE = 5 * 1024 * 1024;
    
    
    // ==================== RabbitMQ相关 ====================
    
    /**
     * 交换机名称
     */
    public static final String EXCHANGE_NAME = "rent.topic.exchange";
    
    /**
     * 房源审核队列
     */
    public static final String QUEUE_HOUSE_AUDIT = "rent.house.audit";
    
    /**
     * 房源审核路由键
     */
    public static final String ROUTING_KEY_HOUSE_AUDIT = "house.audit";
    
    /**
     * 预约通知队列
     */
    public static final String QUEUE_APPOINTMENT = "rent.appointment";
    
    /**
     * 预约通知路由键
     */
    public static final String ROUTING_KEY_APPOINTMENT = "appointment.notify";
    
    /**
     * 申请通知队列
     */
    public static final String QUEUE_APPLY = "rent.apply";
    
    /**
     * 申请通知路由键
     */
    public static final String ROUTING_KEY_APPLY = "apply.notify";

    /**
     * 申请聊天消息队列
     */
    public static final String CHAT_MESSAGE = "rent.chat.message";

    /**
     * 申请聊天消息路由键
     */
    public static final String ROUTING_KEY_CHAT_MESSAGE = "chat.message.notify";
    
    
    // ==================== 业务相关 ====================
    
    /**
     * 密码盐值
     */
    public static final String PASSWORD_SALT = "RentSystem2024";
    
    /**
     * 默认头像URL
     */
    public static final String DEFAULT_AVATAR = "/images/default-avatar.png";



}

